<template>
    <Modal title="联系线索客户" v-model="contactClue" :mask-closable="false" width="1000" @on-cancel="handleDrawerCancel('formItem')">
        <Form label-position="top" :model="params" ref="formItem" :rules="createRuless">

        </Form>
        <DescriptionList :col="3">
            
            <Description term="基本信息：">
                {{ createDatas.user_name }} {{ createDatas.gender_str }}
                <span v-if="createDatas.age">
                    {{ createDatas.age }}岁
                </span>
            </Description>
            <Description term="手机号：">{{ createDatas.mobile }}
            </Description>
            <Description term="微信号：">{{ createDatas.wechat_num }}
            </Description>
            <!-- <Description term="QQ：">
                {{ createDatas.qq_num }}
            </Description> -->
            <Description term="抖音号：">
                {{ createDatas.dy_num }}
            </Description>
            <Description term="部位：">
                <tag v-for="(item, index) in createDatas.body_parts_arr" :key="index">{{ item }}</tag>
            </Description>
            <Description term="渠道：">{{
                createDatas.channel
                }}</Description>
        </DescriptionList>
        <DescriptionList :col="1">
            <Description term="客服备注：">{{
                createDatas.customer_remark
                }}</Description>
        </DescriptionList>
        <Row :gutter="16" style="max-height: 340px; overflow: auto;">
            <Col span="8" v-for="(item, index) in createDatas.upload_talk_img" :key="index"><img
                style="height: 330px; width: 186px; object-fit: cover;" @click="
                        (imgNames = `${createDatas.images_host}${item}`),
                            (visibles = true)
                    " :src="`${createDatas.images_host}${item}`" /></Col>
        </Row>
        <Divider></Divider>
        <Form label-position="top" :model="params1" ref="formItem" :rules="createRuless">
            <Row>
                <Col span="8">
                <FormItem label="联系结果">
                    <RadioGroup v-model="params1.clue_status_id" @on-change="changeclue">
                        <Radio :label="item.value" v-for="item in clueList" :key="item.value"
                            v-if="+item.value !== 9"><span>{{ item.label }}</span></Radio>
                    </RadioGroup>
                </FormItem>
                <Timeline style="max-height: 380px; overflow: auto;">
                    <TimelineItem v-for="item in contact" :key="item.id">
                        <p class="time ivu-mb-8">
                            {{ item.created_at }}
                        </p>
                        <p class="content ivu-mb-8">
                            {{ item.remark }}
                        </p>
                        <p class="consultant ivu-mb-8">
                            <span class="c-inr ivu-mr-8">{{
                                item.realname
                                }}</span>
                            <Badge v-if="item.status_name === '未联系上'" status="success" :text="item.status_name" />
                            <Badge v-if="item.status_name === '无效'" status="processing" :text="item.status_name" />
                            <Badge v-if="item.status_name === '转客户'" status="warning" :text="item.status_name" />
                            <Badge v-if="item.status_name === '新数据'" status="default" :text="item.status_name" />
                        </p>
                    </TimelineItem>
                </Timeline>
                </Col>
                <Col span="16">
                <template v-if="params1.clue_status_id === '8'">
                    <Row :gutter="24">
                        <Col span="5">
                        <FormItem label="姓名">
                            <Input v-model="params1.userName" placeholder="请输入姓名" />
                        </FormItem>
                        </Col>
                        <Col span="6">
                        <FormItem label="性别">
                            <RadioGroup v-model="params1.sex">
                                <Radio :label="0">未知</Radio>
                                <Radio :label="1">男</Radio>
                                <Radio :label="2">女</Radio>
                            </RadioGroup>
                        </FormItem>
                        </Col>
                        <Col span="4">
                        <FormItem label="年龄" prop="age">
                            <InputNumber :max="100" :min="1" v-model="params1.age"></InputNumber>
                        </FormItem>
                        </Col>
                        <Col span="9">
                        <FormItem label="城市" required>
                            <jgcheckcity ref="checkcity" @cityvalue="cityvalue" v-model="city_id" :name="`entry`"/>
                        </FormItem>
                        </Col>
                    </Row>
                    <Row :gutter="24">
                        <Col span="8">
                        <FormItem label="手机号" prop="mobile">
                            <Input v-model="params1.mobile" @on-keyup="params1.mobile=params1.mobile.replace(/\s+|[\r\n]/g,'')" @on-blur="telrepeat(params1.mobile)"
                                placeholder="请输入手机号" />
                        </FormItem>
                        </Col>
                        <Col span="8">
                        <FormItem label="微信号">
                            <Input v-model="params1.weChartNum"
                            @on-keyup="params1.weChartNum=params1.weChartNum.replace(/\s+|[\r\n]/g,'')"
                            @on-blur="
                                            WXrepeat(params1.weChartNum)
                                        " placeholder="请输入微信号" />
                        </FormItem>
                        </Col>
                    </Row>
                    <Row :gutter="24">
                        <Col span="8">
                        <FormItem label="一级病种" prop="oneDiseases">
                            <Select ref="oneSelects" placeholder="请选择一级病种" :key="Math.random() * 10 + 1"
                                v-model="params1.oneDiseases" clearable @on-clear="clearOne" @on-change="changeOne">
                                <Option v-for="item in diseasesArr1" :value="item.value" :key="item.value">{{
                                    item.label }}</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="8">
                        <FormItem label="二级病种" prop="twoDiseases" :rules="twoRules" v-show="diseasesArr2.length>0">
                            <Select placeholder="请选择二级病种" v-model="params1.twoDiseases" clearable
                                :key="Math.random() * 10 + 1">
                                <Option v-for="item in diseasesArr2" :value="item.value" :key="item.value">{{
                                    item.label }}</Option>
                            </Select>
                        </FormItem>
                        </Col>
                        <Col span="8">
                        <FormItem label="患者状态" prop="patientStatus">
                            <Select placeholder="请选择" v-model="params1.patientStatus" clearable>
                                <Option v-for="item in patientStatusArr" :value="item.value" :disabled="
                                                +item.is_select === 0
                                            " :key="item.value">{{ item.label }}</Option>
                            </Select>
                        </FormItem>
                        </Col>
                    </Row>
                    <Row>
                        <Col span="12">
                        <FormItem label="部位" prop="bodyPart" :rules="bodyPartRule">
                            <TreeSelect :max-tag-count="2" v-model="params1.bodyPart" :data="postList" clearable
                                multiple />
                        </FormItem>
                        </Col>
                    </Row>
                    <template v-if="
                                +params1.patientStatus === 2 ||
                                    +params1.patientStatus === 1
                            ">
                        <FormItem label="下次回访时间" prop="day">
                            <Row :gutter="16" type="flex">
                                <Col>
                                <InputNumber :formatter="$inputday" :step="1" :min="0" v-model.number="params1.day"
                                    @on-change="
                                                blurday(params1.day)
                                            ">
                                </InputNumber>
                                </Col>
                                <Col>天后</Col>
                                <Col>
                                <DatePicker :editable="false" :options="optionss" type="date" v-model="DatePicker"
                                    @on-change="
                                                changeday(DatePicker)
                                            " placeholder="请输入回访时间">
                                </DatePicker>
                                </Col>
                            </Row>
                        </FormItem>
                    </template>
                    <template v-if="+params1.patientStatus === 1">
                        <FormItem label="预到时间" prop="day1">
                            <Row :gutter="16" type="flex">
                                <Col>
                                <InputNumber :formatter="$inputday" :step="1" :min="0" v-model.number="params1.day1"
                                    @on-change="
                                                blurday1(params1.day1)
                                            ">
                                </InputNumber>
                                </Col>
                                <Col>天后</Col>
                                <Col>
                                <DatePicker :editable="false" :options="optionss" type="date" v-model="DatePicker1"
                                    @on-change="
                                                changeday1(DatePicker1)
                                            " placeholder="请输入预约时间">
                                </DatePicker>
                                </Col>
                            </Row>
                        </FormItem>
                    </template>
                </template>
                <FormItem label="备注" prop="remark" :rules="remarkRule">
                    <Input type="textarea" placeholder="请备注原因" v-model="params1.remark"
                        :autosize="{ minRows: 2, maxRows: 8 }" />
                </FormItem>
                </Col>
            </Row>
        </Form>
        <div slot="footer">
            <Button @click="handleDrawerCancel('formItem')">取消</Button>
            <Button type="primary" :loading="remarksloading" @click="handlesearch('formItem')">确定</Button>
        </div>
    </Modal>
</template>

<script>
// import jgcheckcity from "@/components/checkcity";
export default {
    name: 'contact', // 联系线索客户
    props: {
        customer: { type: Boolean, default: false },
        type: { type: String },
        data: { type: Object }
    },
    components: {  },
    data() {
        return {
            contactClue: false,
            params: {},
        };
    },

    mounted() {
        
    },

    methods: {
        
    },
};
</script>

<style lang="scss" scoped>

</style>